#include "widget.h"
#include "ui_widget.h"

#include <QHBoxLayout>
#include <QSpacerItem>
#include <QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QHBoxLayout* layout = new QHBoxLayout();
    this->setLayout(layout);

    QPushButton* btn1 =new QPushButton();
    QPushButton* btn2 =new QPushButton();

    QSpacerItem* spacer = new QSpacerItem(200, 20);
    layout->addWidget(btn1);
    // 按顺序，在按钮间添加空白
    layout->addSpacerItem(spacer);
    layout->addWidget(btn2);
}

Widget::~Widget()
{
    delete ui;
}

